<?
class graphWindowsDeviceProcessorUsage  extends graphBase {
	public function getOptions() {
		$opts = array();
		$usages = array();
		$usage_max = array();
		$pluses = array();
		
		foreach ($this->device->cpus AS $i=>$cpu) {
			$opts[] = 'DEF:usage_'.$cpu->index.'='.$this->rrdPath.'processor_'.$cpu->index.'_load.rrd:usage:AVERAGE';
			$opts[] = 'DEF:usage_'.$cpu->index.'_max='.$this->rrdPath.'processor_'.$cpu->index.'_load.rrd:usage:MAX';
			$usages[] = 'usage_'.$cpu->index;
			$usage_max[] = 'usage_'.$cpu->index.'_max';
			$pluses[] = '+';
		}
		if (isset($pluses[0])) unset($pluses[0]);

		if (sizeof($usages) > 1) {
			$opts[] = 'CDEF:usage='.implode(',',$usages).','.implode(',',$pluses).','.sizeof($usages).',/';
			$opts[] = 'CDEF:usage_max='.implode(',',$usage_max).','.implode(',',$pluses).','.sizeof($usage_max).',/';
		} else {
			$opts[] = 'CDEF:usage='.implode(',',$usages);
			$opts[] = 'CDEF:usage_max='.implode(',',$usage_max);
		
		
		}
		$opts[] = '--lower-limit';
		$opts[] = 0;
		$opts[] = '--upper-limit';
		$opts[] = 100;
		$opts[] = 'AREA:usage_max#ffcccc:';
		$opts[] = 'LINE1:usage#ff0000:Usage (%)  ';
		$opts[] = 'GPRINT:usage:LAST:%3.0lf';
		$opts[] = 'GPRINT:usage:AVERAGE:       %3.0lf';
		$opts[] = 'GPRINT:usage:MAX:      %3.0lf\n';
		$opts[] = 'COMMENT:Usage       Current     Average    Maximum\n';
		return $opts;
	}
}